package com.itheima.d3_time;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Test3 {
    public static void main(String[] args) throws ParseException {
        String start = "2023-11-11 00:00:00";
        String end = "2023-11-11 00:10:00";
        String xj = "2023-11-11 00:01:00";
        String xp = "2023-11-11 00:10:52";

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date startDate = sdf.parse(start);
        Date endDate = sdf.parse(end);
        Date xjDate = sdf.parse(xj);
        Date xpDate = sdf.parse(xp);

        long startTime = startDate.getTime();
        long endTime = endDate.getTime();
        long xjTime = xjDate.getTime();
        long xpTime = xpDate.getTime();

        if(xjTime >= startTime && xjTime <= endTime){
            System.out.println("小贾下单成功");
        }else{
            System.out.println("小贾下单失败");
        }

        if(xpTime >= startTime && xpTime <= endTime){
            System.out.println("小皮下单成功");
        }else{
            System.out.println("小皮下单失败");
        }
    }
}
